package a2;
import java.awt.Component;
public class ConstrainedComponent {

	private A2Constraints constraints;
	private Component comp;
	
	/**
	 * Constructs a ConstrainedComponent from a given component and constraints.
	 * @param cons The constraints that will be applied to compn.
	 * @param compn The component to which cons will be applied.
	 */
	public ConstrainedComponent(A2Constraints cons, Component compn)
	{
		this.comp = compn;
		this.constraints = cons;
	}
	
	/**
	 * @return The component associated with this object.
	 */
	public Component component()
	{
		return this.comp;
	}
	
	/**
	 * @return The constraints associated with this object.
	 */
	public A2Constraints constraints()
	{
		return this.constraints;
	}
	
	/**
	 * Sets the component of this object to compn.
	 * @param compn The new component for this ConstrainedComponent.
	 */
	public void setComponent(Component compn)
	{
		this.comp = compn;
	}
	
	/**
	 * Changes the constraints applied to this component. The constraints will
	 * take effect once the container is layed out again.
	 * @param cons The new constraints for this object.
	 */
	public void setConstraints(A2Constraints cons)
	{
		this.constraints = cons;
	}
}
